﻿using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace gt.dotnetcore.webapi.extensions.ApiResults
{
    public class ErrorResult : IActionResult
    {
        int _code;
        string _msg;
        public ErrorResult(int code, string msg)
        {
            _code = code;
            _msg = msg;
        }

        public async Task ExecuteResultAsync(ActionContext context)
        {
            var result = new ApiResponse<string>(_code, _msg);
            var or = new ObjectResult(result);
            await or.ExecuteResultAsync(context);
        }
    }
}
